﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TestGeneric
{
    class Test
    {
        public IList<T> GetBy1<T>()
        {
            if (typeof(T) == typeof(Class1))
            {
                var o = new Class1();
                IList<Class1> i = new List<Class1>();
                i.Add(o);
                return (IList<T>)i;
            }
            else
            {
                var o = new Class2();
                IList<Class2> i = new List<Class2>();
                i.Add(o);
                return (IList<T>)i;
            }
        }

        public IList<T> GetBy2<T>(T t)
        {
            if (typeof(T) == typeof(Class1))
            {
                var o = new Class1();
                IList<Class1> i = new List<Class1>();
                i.Add(o);
                return (IList<T>)i;
            }
            else
            {
                var o = new Class2();
                IList<Class2> i = new List<Class2>();
                i.Add(o);
                return (IList<T>)i;
            }
        }


    }
}
